package com.dong.order.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author DJ
 * @description
 * @date 2021/12/25 10:55 下午
 **/
@Configuration
public class ApplicationContextConfig {

    /**
     * 注入restTemplate的Bean
     * -@LoadBalanced注解开启负载均衡功能
     *
     * @param
     * @return org.springframework.web.client.RestTemplate
     * @author DJ
     * @date 11:08 下午 2021/12/28
     **/
    @Bean
    @LoadBalanced // 自定义负载均衡算法时注释掉
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
